<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Elisa3: behaviors.h File Reference</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">Elisa3
   
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.6.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('behaviors_8h.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">behaviors.h File Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Behaviors module.  
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &quot;<a class="el" href="variables_8h_source.html">variables.h</a>&quot;</code><br/>
<code>#include &lt;math.h&gt;</code><br/>
<code>#include &lt;stdlib.h&gt;</code><br/>
</div>
<p><a href="behaviors_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="behaviors_8h.html#aa65acb00bef7a3d7180a2f9ac2896b21">initBehaviors</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialize variables and functionalities (e.g. random generator) used in the behaviors.  <a href="#aa65acb00bef7a3d7180a2f9ac2896b21"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="behaviors_8h.html#ac1a169c077b398fbdc22bb9c2a55ecc1">obstacleAvoidance</a> (signed int *pwmLeft, signed int *pwmRight)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Obstacle avoidance behavior based on a simplified force field method. It works for both forward and backward motion. The function need to be called before the speed controller and with a cadency of at least 122 Hz (motors pwm frequency).  <a href="#ac1a169c077b398fbdc22bb9c2a55ecc1"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">char&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="behaviors_8h.html#a22f12e04faca8b86cad9383e5c5ea07b">cliffDetected</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Cliff avoidance simple implementation in which the robot can be stopped when a cliff is detected with the ground sensors. The robot has to be calibrated in the surface in which it is moving in order for the behavior to work. The function need to be called before the speed controller and with a cadency of at least 122 Hz (motors pwm frequency). THE FUNCTION IS DEPRECATED: the behavior is directly inserted in the ADC interrupt service routine, thus this function is no more needed and should not be called anymore.  <a href="#a22f12e04faca8b86cad9383e5c5ea07b"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="behaviors_8h.html#a2afba55c6bd92ab0db4cdac3c142f88b">enableObstacleAvoidance</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Enable obstacle avoidance behavior.  <a href="#a2afba55c6bd92ab0db4cdac3c142f88b"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="behaviors_8h.html#a7988093c6402fbf4341ed941d60eaf32">disableObstacleAvoidance</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Disable obstacle avoidance behavior.  <a href="#a7988093c6402fbf4341ed941d60eaf32"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="behaviors_8h.html#a404c13426bfcfafade00b1be6a855397">enableCliffAvoidance</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Enable cliff avoidance behavior.  <a href="#a404c13426bfcfafade00b1be6a855397"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="behaviors_8h.html#af217436726ef03752c9438e0ea85ed79">disableCliffAvoidance</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Disable cliff avoidance behavior.  <a href="#af217436726ef03752c9438e0ea85ed79"></a><br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>Behaviors module. </p>
<dl class="author"><dt><b>Author:</b></dt><dd>Stefano Morgani &lt;<a href="mailto:stefano@gctronic.com">stefano@gctronic.com</a>&gt; </dd></dl>
<dl class="version"><dt><b>Version:</b></dt><dd>1.0 </dd></dl>
<dl class="date"><dt><b>Date:</b></dt><dd>01.02.12 </dd></dl>
<dl class="copyright"><dt><b>Copyright:</b></dt><dd>GNU GPL v3</dd></dl>
<p>This module contains two basic low level behaviors: obstacle and cliff avoidance. Obstacle avoidance is accomplished using the 8 proximity sensors placed around the robot, whereas the cliff avoidance is based on the 4 ground sensors values. </p>
</div><hr/><h2>Function Documentation</h2>
<a class="anchor" id="a22f12e04faca8b86cad9383e5c5ea07b"></a><!-- doxytag: member="behaviors.h::cliffDetected" ref="a22f12e04faca8b86cad9383e5c5ea07b" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">char <a class="el" href="behaviors_8h.html#a22f12e04faca8b86cad9383e5c5ea07b">cliffDetected</a> </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Cliff avoidance simple implementation in which the robot can be stopped when a cliff is detected with the ground sensors. The robot has to be calibrated in the surface in which it is moving in order for the behavior to work. The function need to be called before the speed controller and with a cadency of at least 122 Hz (motors pwm frequency). THE FUNCTION IS DEPRECATED: the behavior is directly inserted in the ADC interrupt service routine, thus this function is no more needed and should not be called anymore. </p>
<dl class="retval"><dt><b>Return values:</b></dt><dd>
  <table class="retval">
    <tr><td class="paramname">0</td><td>cliff not detected </td></tr>
    <tr><td class="paramname">1</td><td>cliff detected </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="af217436726ef03752c9438e0ea85ed79"></a><!-- doxytag: member="behaviors.h::disableCliffAvoidance" ref="af217436726ef03752c9438e0ea85ed79" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="behaviors_8h.html#af217436726ef03752c9438e0ea85ed79">disableCliffAvoidance</a> </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Disable cliff avoidance behavior. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>none </dd></dl>

</div>
</div>
<a class="anchor" id="a7988093c6402fbf4341ed941d60eaf32"></a><!-- doxytag: member="behaviors.h::disableObstacleAvoidance" ref="a7988093c6402fbf4341ed941d60eaf32" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="behaviors_8h.html#a7988093c6402fbf4341ed941d60eaf32">disableObstacleAvoidance</a> </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Disable obstacle avoidance behavior. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>none </dd></dl>

</div>
</div>
<a class="anchor" id="a404c13426bfcfafade00b1be6a855397"></a><!-- doxytag: member="behaviors.h::enableCliffAvoidance" ref="a404c13426bfcfafade00b1be6a855397" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="behaviors_8h.html#a404c13426bfcfafade00b1be6a855397">enableCliffAvoidance</a> </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Enable cliff avoidance behavior. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>none </dd></dl>

</div>
</div>
<a class="anchor" id="a2afba55c6bd92ab0db4cdac3c142f88b"></a><!-- doxytag: member="behaviors.h::enableObstacleAvoidance" ref="a2afba55c6bd92ab0db4cdac3c142f88b" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="behaviors_8h.html#a2afba55c6bd92ab0db4cdac3c142f88b">enableObstacleAvoidance</a> </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Enable obstacle avoidance behavior. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>none </dd></dl>

</div>
</div>
<a class="anchor" id="aa65acb00bef7a3d7180a2f9ac2896b21"></a><!-- doxytag: member="behaviors.h::initBehaviors" ref="aa65acb00bef7a3d7180a2f9ac2896b21" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="behaviors_8h.html#aa65acb00bef7a3d7180a2f9ac2896b21">initBehaviors</a> </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Initialize variables and functionalities (e.g. random generator) used in the behaviors. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>none </dd></dl>

</div>
</div>
<a class="anchor" id="ac1a169c077b398fbdc22bb9c2a55ecc1"></a><!-- doxytag: member="behaviors.h::obstacleAvoidance" ref="ac1a169c077b398fbdc22bb9c2a55ecc1" args="(signed int *pwmLeft, signed int *pwmRight)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="behaviors_8h.html#ac1a169c077b398fbdc22bb9c2a55ecc1">obstacleAvoidance</a> </td>
          <td>(</td>
          <td class="paramtype">signed int *&#160;</td>
          <td class="paramname"><em>pwmLeft</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">signed int *&#160;</td>
          <td class="paramname"><em>pwmRight</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Obstacle avoidance behavior based on a simplified force field method. It works for both forward and backward motion. The function need to be called before the speed controller and with a cadency of at least 122 Hz (motors pwm frequency). </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>none </dd></dl>

</div>
</div>
</div><!-- contents -->
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="behaviors_8h.html">behaviors.h</a>      </li>

    <li class="footer">Generated on Thu Dec 4 2014 08:30:48 for Elisa3 by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.6.1 </li>
   </ul>
 </div>


</body>
</html>
